package ebj.common.multithread;

public class MyThread implements Runnable {
    private int __COMMON_NUM = 50;
    private boolean isrunning = true;
    public void run() {
        while (isrunning) {
            synchronized (this) {
                if (__COMMON_NUM > 0) {
                    System.out.println(Thread.currentThread().getName() + "正在操作：" + __COMMON_NUM);
                    __COMMON_NUM --;
                }else {
                  this.isrunning = false;  
                }
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
